#ifndef __UNBOUNDEDBUFFER__
#define __UNBOUNDEDBUFFER__
#include "Semaphore.h"
#include "Message.h"
#include <queue>


using namespace std;

class UnBoundedMailBox
{
  private:
	Semaphore* m_Nonempty;
	Mutex* mutex;//for critical section
	int m_maxLength;
	queue<Message*> mailbox;
	
  public:
	UnBoundedMailBox() ;
	~UnBoundedMailBox();
	int getMaxSize();
	int getSize();
	void cleanMailBox();
	bool isEmpty();
	int PutIn(Message* m);
	Message* Extract();
};
#endif

